<template>
  <div class="home">
    <!-- 文件上传组件 -->
    <FileUploader
      :url="url"
      :params="params"
      :mime_types="mimeTypes"
      :max_file_size="maxFileSizeLimit"
      @whenUpload="whenUpload"
      @successCallBackLater="uploadCallBack"
      @errorCallBackLater="errorCallBack"
    />
  </div>
</template>

<script>
// @ is an alias to /src
// import HelloWorld from '@/components/HelloWorld.vue'
//导出文件上传组件
import FileUploader from "@/components/fileTools/FileUploader";

export default {
  name: "home",
  components: {
    //注册组件
    FileUploader,
  },
  data() {
    return {
      url: "http://localhost:8099/sci_web/upload",
      params: {
        username: "小张",
        password: "258596",
        role: 0,
        state: 1,
      },
      mimeTypes: "image/*,audio/*,video/*,text/*,application/zip", //MIME类型-默认支持文本/图像/音视频/二进制压缩包
      maxFileSizeLimit: 1024,
    };
  },
  methods: {
    whenUpload(msg) {
      console.log(msg);
    },
    uploadCallBack(uploader, file, responseObject) {
      console.log(responseObject);
    },
    errorCallBack(uploader, error) {
      console.log(error);
    },
  },
};
</script>
